#pragma once


#include "Camera.h"

class CUserInfoDlg : public CDialogImpl<CUserInfoDlg>, public CWinDataExchange<CUserInfoDlg>
{
public:
    enum { IDD = IDD_DIALOG_USER_INFO };

    BEGIN_MSG_MAP(CUserInfoDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        COMMAND_ID_HANDLER(IDOK, OnOK)
        COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
        COMMAND_HANDLER(IDC_BUTTON_ADD_USER, BN_CLICKED, OnBnClickedButtonAddUser)
        COMMAND_HANDLER(IDC_BUTTON_UPDATE_USER, BN_CLICKED, OnBnClickedButtonUpdateUser)
        COMMAND_HANDLER(IDC_BUTTON_SEARCH, BN_CLICKED, OnBnClickedButtonSearch)
        NOTIFY_HANDLER(IDC_LIST_USER_INFO, NM_DBLCLK, OnNMDblclkListUserInfo)
        COMMAND_HANDLER(IDC_BUTTON_DELETE, BN_CLICKED, OnBnClickedButtonDelete)
        COMMAND_HANDLER(IDC_BUTTON_TAKE_CAPTURE, BN_CLICKED, OnBnClickedButtonTakeCapture)
        COMMAND_HANDLER(IDC_EDIT_BIRTH, EN_CHANGE, OnEnChangeEditBirth)
        COMMAND_HANDLER(IDC_BUTTON_SET_CAPTURE, BN_CLICKED, OnBnClickedButtonSetCapture)
        COMMAND_HANDLER(IDC_BUTTON_CURRENT_TIME, BN_CLICKED, OnBnClickedButtonCurrentTime)
        COMMAND_HANDLER(IDC_BUTTON_ADD_RECORD, BN_CLICKED, OnBnClickedButtonAddRecord)
        COMMAND_HANDLER(IDC_BUTTON_DELETE_RECORD, BN_CLICKED, OnBnClickedButtonDeleteRecor)
        COMMAND_HANDLER(IDC_BUTTON_GET_USER_ID, BN_CLICKED, OnBnClickedButtonGetUserId)
        COMMAND_HANDLER(IDC_EDIT_STATUS_HEIGHT2, EN_CHANGE, OnEnChangeEditStatusHeight2)
        COMMAND_HANDLER(IDC_EDIT_STATUS_WEIGHT2, EN_CHANGE, OnEnChangeEditStatusWeight2)
    END_MSG_MAP()


    BEGIN_DDX_MAP(CUserInfoDlg)
        DDX_TEXT(IDC_EDIT_NAME, m_strName )
        DDX_CONTROL_HANDLE(IDC_COMBO_SEX, m_cSex)
        DDX_INT(IDC_EDIT_BIRTH, m_nBirth)
        DDX_TEXT(IDC_EDIT_NATIVE_PLACE, m_strNativePlace)
        DDX_TEXT(IDC_EDIT_NATHIONALITY, m_strNationality)
        DDX_CONTROL_HANDLE(IDC_COMBO_POLITICS, m_cPolitics)
        DDX_TEXT(IDC_EDIT_ID, m_strId)
        DDX_TEXT(IDC_EDIT_MAIL, m_strMail)
        DDX_TEXT(IDC_EDIT_ADDRESS, m_strAddress)
        DDX_TEXT(IDC_EDIT_POST_CODE, m_strPostCode)
        DDX_TEXT(IDC_EDIT_MOBILE, m_strMobile)
        DDX_TEXT(IDC_EDIT_PHONE, m_strPhone)
        DDX_TEXT(IDC_EDIT_MAN_INCIDENT, m_strManIncident)
        DDX_TEXT(IDC_EDIT_MAN_RELATION, m_strManRelatioin)
        DDX_TEXT(IDC_EDIT_MAN_PHONE, m_strManPhone)

        DDX_CHECK(IDC_CHECK_SPORTS_RUN, m_nSportsRun)
        DDX_CHECK(IDC_CHECK_SPORTS_BIKE, m_nSportsBike)
        DDX_CHECK(IDC_CHECK_SPORTS_POWER, m_nSportsPower)        
        DDX_TEXT(IDC_EDIT_SPORTS_OTHER, m_strSportsOther)
        DDX_CHECK(IDC_CHECK_HIGH_PRESSURE, m_nHighPressure)
        DDX_CHECK(IDC_CHECK_HEART_DISEACE, m_nHeartDisease)
        DDX_CHECK(IDC_CHECK_PSYCHOPATHY, m_nPsychopathy)
        DDX_CHECK(IDC_CHECK_EPILEPTICS, m_nEpileptics)
        DDX_CHECK(IDC_CHECK_DIABETES, m_nDiabetes)
        DDX_CHECK(IDC_CHECK_BLOOD_DISEASE, m_nBloodDisease)
        DDX_CHECK(IDC_CHECK_BIG_SURGERY, m_nBigSurgery)
        DDX_CHECK(IDC_CHECK_PESTILENCE, m_nPestilence)
        DDX_CHECK(IDC_CHECK_OTHER_DISEASE, m_nOtherDisease)
        DDX_TEXT(IDC_EDIT_OTHER_DISEASE_NAME, m_strOtherDisease)
        DDX_CHECK(IDC_CHECK_SPORTS, m_nAgreeSports)

        DDX_FLOAT(IDC_EDIT_STATUS_HEIGHT2, m_height)
        DDX_FLOAT(IDC_EDIT_STATUS_WEIGHT2, m_weight)
        DDX_FLOAT(IDC_EDIT_STATUS_WAISTLINE2, m_waistline)
        DDX_FLOAT(IDC_EDIT_BEILI_TEST2, m_beli_test)
        DDX_FLOAT(IDC_EDIT_BLOOD_PRESSURE2, m_blood_pressure)
        DDX_FLOAT(IDC_EDIT_LUNG_CAPACITY2, m_lung_capacity)
        DDX_FLOAT(IDC_EDIT_STAIRS_TEST2, m_stairs_test)
        DDX_FLOAT(IDC_EDIT_WOLI_TEST2, m_woli_test)
        DDX_FLOAT(IDC_EDIT_ZONGTIAO_TEST2, m_zongtiao_test)
        DDX_FLOAT(IDC_EDIT_BIYANDANJIAO_TEST2, m_biyandanjiao_test)
        DDX_FLOAT(IDC_EDIT_QIANQU_TEST2, m_qianqu_test)
        DDX_FLOAT(IDC_EDIT_FANYINGSHI_TEST2, m_fanyingshi_test)
        DDX_CONTROL_HANDLE(IDC_DATETIMEPICKER_TEST_TIME, m_cTime)
        DDX_CONTROL_HANDLE(IDC_LIST_STATUS_RECORD2, m_lcStatusRecord)

        DDX_TEXT(IDC_EDIT_ID2, m_strId2)

    END_DDX_MAP()


    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
    LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

    void    RefreshUI(Basic_Info_t* pBasic, Status_Info_t* pStatus);
    void    OnCaptureFile(Image_Cap* pCap);
    void    ShowImage();
protected:
    CString             m_strName;
    CComboBox           m_cSex;
    int                 m_nBirth;
    CString             m_strNativePlace;
    CString             m_strNationality;
    CComboBox           m_cPolitics;
    CString             m_strId;
    CString             m_strMail;
    CString             m_strAddress;
    CString             m_strPostCode;
    CString             m_strMobile;
    CString             m_strPhone;
    CString             m_strManIncident;
    CString             m_strManRelatioin;
    CString             m_strManPhone;

    int                 m_nSportsRun;
    int                 m_nSportsBike;
    int                 m_nSportsPower;
    int                 m_nSportsOther;
    CString             m_strSportsOther;
    int                 m_nHighPressure;
    int                 m_nHeartDisease;
    int                 m_nPsychopathy;
    int                 m_nEpileptics;
    int                 m_nDiabetes;
    int                 m_nBloodDisease;
    int                 m_nBigSurgery;
    int                 m_nPestilence;
    int                 m_nOtherDisease;
    CString             m_strOtherDisease;
    int                 m_nAgreeSports;


    // status
    float		m_height;
    float		m_weight;
    float		m_waistline;
    float		m_beli_test;
    float		m_blood_pressure;
    float		m_lung_capacity;
    float		m_stairs_test;
    float		m_woli_test;
    float		m_zongtiao_test;
    float		m_biyandanjiao_test;
    float		m_qianqu_test;
    float		m_fanyingshi_test;

    CDateTimePickerCtrl m_cTime;

    CListViewCtrl	m_lcStatusRecord;




    CString             m_strId2;

    CCamera             m_camera;


    int                 m_nImageWidth ;
    int                 m_nImageHeight;
    BYTE*               m_pImageBuf;
    int                 m_nImageBufLen ;

public:
    LRESULT OnBnClickedButtonAddUser(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
public:
    LRESULT OnBnClickedButtonUpdateUser(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
public:
    LRESULT OnBnClickedButtonSearch(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
public:
    LRESULT OnNMDblclkListUserInfo(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
public:
    LRESULT OnBnClickedButtonDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonTakeCapture(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEnChangeEditBirth(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonSetCapture(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonCurrentTime(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonAddRecord(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonDeleteRecord2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonDeleteRecor(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnBnClickedButtonGetUserId(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEnChangeEditStatusHeight2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEnChangeEditStatusWeight2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
